package com.kemai.designmode.factory.builder

import com.kemai.designmode.entry.fruit.Apple
import com.kemai.designmode.entry.fruit.Banana
import com.kemai.designmode.entry.fruit.FruitMeal
import com.kemai.designmode.entry.fruit.Orange

/**

 *@description:会员套餐
 * @author: zhaoshanshan
 * @date: 2022/10/3 3:28 下午

 */
class MemberMealBuilder:Builder {

    private  val  fruitMeal:FruitMeal = FruitMeal()
    override fun buildApple(price: Double) {
        val apple = Apple()
        apple.price  = price
        fruitMeal.apple = apple
    }

    override fun buildBanana(price: Double) {
        val banana = Banana()
        banana.price  = price
        fruitMeal.banana = banana
    }

    override fun buildOrange(price: Double) {
        val orange = Orange()
        orange.price  = price
        fruitMeal.orange = orange
    }

    override fun getFruitMeal(): FruitMeal {

        fruitMeal.discount = 10.0
        fruitMeal.calculateTotalCount()
        return fruitMeal

    }


}